cards=input().split()
def map(card):
    if card=="J":
        return 11
    elif card=="Q":
        return 12
    elif card=="K":
        return 13
    elif card=="A":
        return 14
    elif card=="2":
        return 16
    else:
        return int(card)

def getResult():
    cards.sort(key=lambda x:map(x))

    stack=[]
    ans=[]
    while len(cards)>0:
        bot=cards.pop(0)
        if len(stack)==0:
            stack.append(bot)
            continue
        top=stack[-1]
        if map(bot)-map(top)==1:
            stack.append(bot)
        elif map(bot)==map(top):
            cards.append(bot)
        else:
            if len(stack)>=5:
                ans.append(" ".join(stack))
            stack.clear()
            stack.append(bot)
        # if len(stack) >= 5:
        #     ans.append(" ".join(stack))
        # stack.clear()
        # stack.append(bot)

    if len(stack)>=5:
        ans.append(" ".join(stack))
    if len(ans)==0:
        print("No")
    else:
        ans.sort(key=lambda x:map(x[0]))
        for an in ans:
            print(an)


getResult()

# 2 9 J 2 3 4 K A 7 9 A 5 6
# 2 9 J 10 3 4 K A 7 Q A 5 6
# 2 9 9 9 3 4 K A 10 Q A 5 6
# 3 4 5 6 7 8 9 10 J Q K A 2
